	<!DOCTYPE html>
		{extend name="common/application" /}
		{block name="title"}<title>个人中心-评价管理</title>{/block}
		{block name="css"}
		<link rel="stylesheet" type="text/css" href="_CSS_/help.css" />
		<link rel="stylesheet" type="text/css" href="_CSS_/judge.css"/>

		{/block}
		<!-- 主体内容 -->
		{block name="content"}
			<!-- 主体内容 -->
			<div class="main">
				<div class="mainBody normalBox clearfix">
					<!--左菜单-->
					<ul class="menuList fl">
						<li>
							<a class="menuItem dropBg" href="personal.html"><span class="icons icon-account"></span>账户管理</a>
							<div class="childMenu">
								<a class="menuchildItem" href="personal.html">个人资料</a>
								<a class="menuchildItem" href="certification.html">实名认证</a>
								<a class="menuchildItem" href="account.html">账户安全</a>
							</div>
						</li>
						<li>
							<a class="menuItem dropBg" href="order.html"><span class="icons icon-order"></span>我的订单</a>
							<div class="childMenu">
								<a class="menuchildItem" href="order.html">我的订单</a>
							</div>
						</li>
						<li>
							<a class="menuItem dropBg" href="collect_news.html"><span class="icons icon-collection"></span>我的收藏</a>
							<div class="childMenu">
								<a class="menuchildItem" href="collect_news.html">资讯收藏</a>
								<a class="menuchildItem" href="collect_course.html">课程收藏</a>
								<a class="menuchildItem" href="collect_products.html">商品收藏</a>
								<a class="menuchildItem" href="collect_stores.html">店铺收藏</a>
							</div>
						</li>
						<li>
							<a class="menuItem dropBg" href="address.html"><span class="icons icon-address"></span>地址管理</a>
							<div class="childMenu">
								<a class="menuchildItem" href="address.html">地址管理</a>
							</div>
						</li>
						<li class="showChild">
							<a class="menuItem dropBg" href="judge.html"><span class="icons icon-evaluate"></span>评价管理</a>
							<div class="childMenu">
								<a class="menuchildItem activeMenu" href="judge.html">评价管理</a>
							</div>
						</li>
						<li>
							<a class="menuItem dropBg" href="complain.html"><span class="icons icon-price"></span>申述退款</a>
							<div class="childMenu">
								<a class="menuchildItem" href="complain.html">申述</a>
								<a class="menuchildItem" href="refund_money.html">退款</a>
							</div>
						</li>
						<li class="bb0">
							<a class="menuItem dropBg" href="message.html"><span class="icons icon-news"></span>消息中心</a>
							<div class="childMenu">
								<a class="menuchildItem" href="message.html">消息中心</a>
							</div>
						</li>
					</ul>
					<!--右内容-->
					<div class="menuContent fr">
						<div class="menuConHeader">
							<!--面包屑导航-->
							<div class="breadcrumb">
								<p>当前位置：
									<a href="judge.html">评价管理</a> &gt;
									<a class="curPage" href="javascript:;">历史评价</a>
								</p>
							</div>
						</div>
						<div class="menuConBody">
							<!--筛选-->
							<div class="one_tab">
								<a class="oneType active_on" href="javascript:;" value="2">来自卖家的评价</a>
								<a class="oneType" href="javascript:;" value="1">对服务商品的评价</a>
							</div>
							<div class="judgement seller">
								<div class="judgeHeader">
									<span class="w150">订单编号</span>
									<span class="w408">评价内容</span>
									<span class="w150">评价人</span>
									<span class="w150">操作</span>
								</div>
								<div class="judgeBody">

								</div>
							</div>
							<div class="judgement product">
								<label>评价:</label>
								<div class="model-select-box">					
								  	<div class="model-select-text" data-value=""></div>
								  	<ul class="model-select-option">
								    	<li data-option="1" class="seleced data-selected">好评</li>
								    	<li data-option="2">中评</li>
								    	<li data-option="3">差评</li>
								  	</ul>
								</div>
								<div class="judgeHeader">
									<span class="w150">评论类型</span>
									<span class="w150">订单编号</span>
									<span class="w408">评价内容</span>								
									<span class="w150">操作</span>
								</div>
								<div class="judgeBody">

								</div>
							</div>
							<div id="page"></div>
						</div>
					</div>
				</div>
			</div>
			{/block}



			{block name="js"}

		<script src="_P_/layer/layer.js"></script>
	<script src="_JS_/time.js"></script>
		<script type="text/javascript">
			$(document).ready(function(){
				judge_list(1);
				/*一级导航*/
				$('.oneType').on('click',function(){
					$('.oneType').removeClass('active_on');
					$(this).addClass('active_on');
					var val = $(this).attr('value');
					if(val == 2){
						$('.seller').css('display','block');
						$('.product').css('display','none');
					}else{
						$('.product').css('display','block');
						$('.seller').css('display','none');
					}
					judge_list(1);
				});
//				$('.model-select-option li').on('click',function(){
//					$('.model-select-option li').removeClass('seleced data-selected');
//					$(this).addClass('seleced data-selected');
//				});
				function judge_list(page){
					var sheet=$('.oneType[class="oneType active_on"]').attr('value');
					var state=$('.model-select-text').attr('data-value');
					var userinfo=$.cookie('userinfo');
					//var userinfo = 1;
					if(userinfo) {
						var user_login = $.base64.decode(userinfo).split(",");
						var uid = user_login[0];
						$.ajax({
							type: "get",
							url: "/index.php/api/form/comment_list",
							data: {
								'sheet': sheet,
								'state': state,
								'page': page,
								'index': 1,
								'uid':uid
							},
							dataType: 'jsonp',
							success: function (msg) {
								if (msg.code == 200) {
									var html='';
									if(sheet==2){
										for(var i=0;i<msg.data.data.length;i++){
											html+='<div class="judgeItem" num="'+msg.data.data[i].id+'"><span class="orderNo">'+msg.data.data[i].order_number+'</span>';
											html+='<div class="orderCon"><p class="content moreline" limit="68">'+msg.data.data[i].content+'</p>';
											html+='<span class="time">'+getMyDate(msg.data.data[i].time*1000)+'</span></div>';
											html+='<p class="sellerName">卖家：<span>'+msg.data.data[i].seller_name+'</span></p>';
											html+='<a class="goDetails" href="javascript:;">查看详情</a></div>';
										}
										$('.seller .judgeBody').html(html);
									}else{
										for(var j=0;j<msg.data.data.length;j++){
											html+='<div class="judgeItem" num="'+msg.data.data[j].id+'"><span class="judgeType">';
											if(msg.data.data[j].state==1){
												html+='好评';
											}else if(msg.data.data[j].state==2){
												html+='中评';
											}else{html+='差评';}
											html+='</span><span class="orderNo">'+msg.data.data[j].order_number+'</span>';
											html+='<div class="orderCon"><p class="content moreline" limit="68">'+msg.data.data[j].content+'</p>';
											html+='<span class="time">'+getMyDate(msg.data.data[j].time*1000)+'</span></div>';
											html+='<a class="goDetails" href="javascript:;">查看详情</a></div>';
										}
										$('.product .judgeBody').html(html);
									}
									$('#page').html(msg.data.render);
								}
								if (msg.code == 1000) {
									if(sheet==1){
										$('.product .judgeBody').html('');
									}else{
										$('.seller .judgeBody').html('');
									}
									layer.msg('暂无评价！', {icon: 5});
								}
								/*查看服务商品的评价*/
								$('.product .goDetails').on('click',function(){
									var order_number=$(this).parent().find('.orderNo').html();
									var judgeType=$(this).parent().find('.judgeType').html();
									var time=$(this).parent().find('.time').html();
									var content =$(this).parent().find('.content ').html();
									layer.open({
										type: 1,
										title: '查看详情',
										closeBtn: false,
										shadeClose: true,
										scrollbar: false,
										area: ['600px', '320px'],
										content: "<div class='forms' id='details'><div class='form-group'><label>订单编号：</label><span class='orderNumber'>"+order_number+"</span></div><div class='form-group'><label>评价内容：</label><span>"+content+"</span></div><div class='form-group'><label>评价时间：</label><span>"+time+"</span></div><div class='form-group'><label>评价类型：</label><span>"+judgeType+"</span></div></div>",
//				       					 btn: ['发送', '取消'],
										yes: function(index, layero) {
											//do something
											layer.close(index); //如果设定了yes回调，需进行手工关闭
										}
									});
								});			/*查看卖家评论*/
								$('.seller .goDetails').on('click',function(){
									var number=$(this).parent().find('.orderNo').html();
									var get_time=$(this).parent().find('.time').html();
									var content =$(this).parent().find('.content ').html();
									var sellerName =$(this).parent().find('.sellerName span').html();
									layer.open({
										type: 1,
										title: '查看详情',
										closeBtn: false,
										shadeClose: true,
										scrollbar: false,
										area: ['600px', '320px'],
										content: "<div class='forms' id='details'><div class='form-group'><label>订单编号：</label><span class='orderNumber'>"+number+"</span></div><div class='form-group'><label>评价内容：</label><span>"+content+"</span></div><div class='form-group'><label>评价时间：</label><span>"+get_time+"</span></div><div class='form-group'><label>评价人：</label><span>"+sellerName+"</span></div></div>",
//				        btn: ['发送', '取消'],
										yes: function(index, layero) {
											//do something
											layer.close(index); //如果设定了yes回调，需进行手工关闭
										}
									});
								});

							}
						});
					}else{
						layer.msg('还未登录！', {icon: 51});
					}
				}
				
				/*查看卖家评论*/
				$('.seller .goDetails').on('click',function(){
					layer.open({
				        type: 1,
				        title: '查看详情',
				        closeBtn: false,
				        shadeClose: true,
				        scrollbar: false,
				        area: ['600px', '320px'],
				        content: "<div class='forms' id='details'><div class='form-group'><label>订单编号：</label><span class='orderNumber'>20170002654</span></div><div class='form-group'><label>评价内容：</label><span>服务不错，挺有安全保障的服务不错，挺有安全保障的服务不错，挺有安全保障的服务不错，挺有安全保障的服务不错，挺有安全保障的服务不错，挺有安全保障的</span></div><div class='form-group'><label>评价时间：</label><span>2018-04-08</span></div><div class='form-group'><label>评价人：</label><span>知果汇</span></div></div>",
//				        btn: ['发送', '取消'],
				        yes: function(index, layero) {
							//do something
							layer.close(index); //如果设定了yes回调，需进行手工关闭
						}
				    });
				});
				



				/*模拟网页中所有的下拉列表select*/
			    function selectModel(){
			        var $box = $('div.model-select-box');
			        var $option = $('ul.model-select-option', $box);
			        var $txt = $('div.model-select-text', $box);
			        var speed = 10;
			        /*
			         * 单击某个下拉列表时，显示当前下拉列表的下拉列表框
			         * 并隐藏页面中其他下拉列表
			         */
			        $txt.click(function(e) {
			                $option.not($(this).siblings('ul.model-select-option')).slideUp(speed, function(){
			                    int($(this));
			                });
			                $(this).siblings('ul.model-select-option').slideToggle(speed, function(){
			                    int($(this));
			                });
			                return false;
			            });
			        //点击选择，关闭其他下拉
			        /*
			         * 为每个下拉列表框中的选项设置默认选中标识 data-selected
			         * 点击下拉列表框中的选项时，将选项的 data-option 属性的属性值赋给下拉列表的 data-value 属性，并改变默认选中标识 data-selected
			         * 为选项添加 mouseover 事件
			         */
			        $option.find('li').each(function(index, element) {
			                if($(this).hasClass('seleced')){
			                    $(this).addClass('data-selected');
			                }
			            })
			            .mousedown(function(){
			                $(this).parent().siblings('div.model-select-text').text($(this).text())
			                    .attr('data-value', $(this).attr('data-option'));
			                
			                $option.slideUp(speed, function(){
			                    int($(this));
			                });
							judge_list(1);
			                $(this).addClass('seleced data-selected').siblings('li').removeClass('seleced data-selected');
			                return false;

			            })
			            .mouseover(function(){
			                $(this).addClass('seleced').siblings('li').removeClass('seleced');
			            });

			        //点击文档，隐藏所有下拉
			        $(document).click(function(e) {
			            $option.slideUp(speed, function(){
			                int($(this));
			            });
			        });
			        //初始化默认选择
			        function int(obj){
			            obj.find('li.data-selected').addClass('seleced').siblings('li').removeClass('seleced');
			        }

			    }
			
			    selectModel();
			});
		</script>
			{/block}


